package my.jieh.tips.swing;

import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;

public class SpinDemo2 {
  public static void main(String args[]) {

    // create a JFrame

    JFrame frame = new JFrame("SpinDemo2");
    frame.setDefaultCloseOperation(
        JFrame.EXIT_ON_CLOSE);

    // create a JSpinner
    // based on a list of strings

    Object list[] = {
        "string1", "string2",
        "string3"};
    SpinnerModel sm =
        new SpinnerListModel(list);
    JSpinner jsp = new JSpinner(sm);

    // create a JPanel

    JPanel panel = new JPanel();
    panel.setPreferredSize(
        new Dimension(300, 300));
    panel.add(jsp);
    frame.getContentPane().add(panel);

    // display the frame

    frame.pack();
    frame.setVisible(true);
  }
}